package com.specter.serv.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.specter.mvc.model.Request;
import com.specter.mvc.model.dao.BaseDao;
import com.specter.serv.service.AcisService;

/**
 * 用户应用平台服务
 * 
 * @author Liang.Wang
 * @version 1.0
 */
@Service
public class AcisServiceImpl implements AcisService {
    private String prefix = "com.specter.serv.entity.Acis";
    private @Autowired BaseDao baseDao;

    @Override
    public Object dept(String type, Request request) {
        request = request == null ? Request.me() : request;
        if ("list".equals(type)) {
            request.setQueryType(Request.QueryType.LIST);
            return baseDao.select(prefix + ".select_dept_list", request);
        }
        if ("page".equals(type)) {
            request.setQueryType(Request.QueryType.PAGE);
            return baseDao.selectPage(prefix + ".select_dept_list", request);
        }
        return null;
    }

    @Override
    public Object user(String type, Request request) {
        request = request == null ? Request.me() : request;
        if ("list".equals(type)) {
            request.setQueryType(Request.QueryType.LIST);
            return baseDao.select(prefix + ".select_user_list", request);
        }
        if ("page".equals(type)) {
            request.setQueryType(Request.QueryType.PAGE);
            return baseDao.selectPage(prefix + ".select_user_list", request);
        }
        return null;
    }

    @Override
    public Object prop(String type, Request request) {
        request = request == null ? Request.me() : request;
        if ("list".equals(type)) {
            request.setQueryType(Request.QueryType.LIST);
            return baseDao.select(prefix + ".select_prop_list", request);
        }
        if ("page".equals(type)) {
            request.setQueryType(Request.QueryType.PAGE);
            return baseDao.selectPage(prefix + ".select_prop_list", request);
        }
        return null;
    }
}
